package com.atguigu.tingshu.user.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.user.client.impl.UserDegradeFeignClient;
import com.atguigu.tingshu.vo.user.UserInfoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * @author atguigu
 */
@FeignClient(value = "service-user", path = "api/user",fallback = UserDegradeFeignClient.class)
public interface UserFeignClient {


    /**
     * 获取全部VIP会员服务配置信息
     * 用于判断用户付款类型（会员付费类型---包年包月等）
     * /api/user/vipServiceConfig/findAll
     * @return
     */
    @GetMapping("/vipServiceConfig/findAll")
    public Result<List<VipServiceConfig>> findAll();




    /**
     * 即判断用户是否已经购买专辑或者专辑内的声音
     * notice ： 此时支持用户整张专辑购买、或者专辑某一个声音单独购买
     * Map<Long,Integer> == {trackId?1:0} 1 表示已购买 0 表示未购买
     * @param userId
     * @param albumId
     * @param checkedTrackIds
     * @return
     */
    @PostMapping("/userInfo/userIsPaidTrack/{userId}/{albumId}")
    public Result<Map<Long,Integer>> userIsPaidTrack(@PathVariable Long userId,
                                                     @PathVariable Long albumId,
                                                     @RequestBody List<Long> checkedTrackIds);

    /**
     * /api/user/userInfo/getUserInfoVo/{userId}
     * 根据用户ID查询用户信息
     * @param userId
     * @return
     */
    @GetMapping("/userInfo/getUserInfoVo/{userId}")
    public Result<UserInfoVo> getUserInfoVo(@PathVariable Long userId);
}
